{% extends "header.html" %}
{% block title %}
<title>注册</title>
{% endblock %}
{% block body %}

<div class="row col-md-8 col-md-offset-2" >
  <h1>注册</h1>
  <form method="post">
    {% csrf_token %}
   <div class="form-group">
    {{ rgf.username.label_tag }}
    {{ rgf.username }}
  </div>
  <div class="form-group">
    {{ rgf.password.label_tag }}
    {{ rgf.password }}
  </div>
  <div class="form-group">
    {{ rgf.password2.label_tag }}
    {{ rgf.password2 }}
  </div>
      <div class="form-group">
    {{ rgf.email.label_tag }}
    {{ rgf.email }}
  </div>
     <div class="form-group">
    {{ rgf.sex.label_tag }}
    {{ rgf.sex }}
  </div>
    <div class="form-group">
    {{ rgf.telephone.label_tag }}
    {{ rgf.telephone }}
  </div>

  <div class="form-group">
   {% if request.method == "POST" %}
        {% for fields in rgf %}
            {% for error in fields.errors %}
                {% if error %}
                <p class="text-danger"> {{ error }} </p>
                {% endif %}
            {% endfor %}
        {% endfor %}
      {% endif %}

  </div>


  <button type="submit" class="btn btn-primary">注册</button>
    <a class="btn btn-primary" href="/user/login" role="button">已有账号？去登录</a>
</form>


</div>


{% endblock %}